{% extends 'admin/base.html' %}

{% block title %}删除用户 - 管理后台{% endblock %}
{% block page_title %}删除用户{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-8">
        <div class="card border-danger">
            <div class="card-header bg-danger text-white">
                <h5 class="card-title mb-0">
                    <i class="bi bi-exclamation-triangle"></i> 确认删除用户
                </h5>
            </div>
            <div class="card-body">
                <div class="alert alert-danger">
                    <h6><i class="bi bi-exclamation-triangle"></i> 警告</h6>
                    <p class="mb-0">您即将删除用户 <strong>{{ target_user.user.username }}</strong>，此操作不可撤销！</p>
                </div>
                
                <div class="card">
                    <div class="card-body">
                        <h6>用户信息：</h6>
                        <table class="table table-borderless table-sm">
                            <tr>
                                <td class="fw-bold">用户名：</td>
                                <td>{{ target_user.user.username }}</td>
                            </tr>
                            <tr>
                                <td class="fw-bold">所属学院：</td>
                                <td><span class="badge bg-info">{{ target_user.get_college_display }}</span></td>
                            </tr>
                            <tr>
                                <td class="fw-bold">学院管理员：</td>
                                <td>
                                    {% if target_user.is_admin %}
                                    <span class="badge bg-success">是</span>
                                    {% else %}
                                    <span class="badge bg-secondary">否</span>
                                    {% endif %}
                                </td>
                            </tr>
                            <tr>
                                <td class="fw-bold">超级管理员：</td>
                                <td>
                                    {% if target_user.is_super_admin %}
                                    <span class="badge bg-danger">是</span>
                                    {% else %}
                                    <span class="badge bg-secondary">否</span>
                                    {% endif %}
                                </td>
                            </tr>
                            <tr>
                                <td class="fw-bold">创建时间：</td>
                                <td>{{ target_user.created_at|date:"Y-m-d H:i" }}</td>
                            </tr>
                        </table>
                    </div>
                </div>
                
                <form method="post" class="mt-4">
                    {% csrf_token %}
                    <div class="d-flex justify-content-between">
                        <a href="{% url 'bike:user_management' %}" class="btn btn-outline-secondary">
                            <i class="bi bi-arrow-left"></i> 取消
                        </a>
                        <button type="submit" class="btn btn-danger" onclick="return confirm('最后确认：确定要删除用户 {{ target_user.user.username }} 吗？')">
                            <i class="bi bi-trash"></i> 确认删除
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">
                <h6 class="card-title mb-0">
                    <i class="bi bi-info-circle"></i> 删除说明
                </h6>
            </div>
            <div class="card-body">
                <h6>删除后果：</h6>
                <ul class="list-unstyled small">
                    <li><i class="bi bi-x-circle text-danger me-2"></i>用户账户将被永久删除</li>
                    <li><i class="bi bi-x-circle text-danger me-2"></i>用户无法再登录系统</li>
                    <li><i class="bi bi-x-circle text-danger me-2"></i>相关权限设置将丢失</li>
                </ul>
                
                <h6 class="mt-3">注意事项：</h6>
                <ul class="list-unstyled small text-muted">
                    <li>• 此操作不可撤销</li>
                    <li>• 建议先备份重要数据</li>
                    <li>• 确认用户不再需要访问系统</li>
                </ul>
            </div>
        </div>
    </div>
</div>
{% endblock %}
